﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using Present.Commands.Async.Actions;

namespace Present.Commands.Rx
{
    public static class IAsyncActionExtensions
    {
        public static IObservable<EventPattern<EventArgs>> CanExecuteChangedObservable(this IAsyncAction me)
        {
            return Observable.FromEventPattern<EventArgs>(e => me.CanExecuteChanged += e, e => me.CanExecuteChanged -= e);
        }
    }
}